﻿// ***********************************************************************
// Assembly         : Admin.Framework.Core.Domain
// Author           : xwltz
// Created          : 2019-05-25
//
// Last Modified By : xwltz
// Last Modified On : 2019-05-25
// ***********************************************************************
// <summary>
//  主键实体类
//  所有的数据库实体必须继承该实体类
// </summary>
// ***********************************************************************

using System;
using System.ComponentModel.DataAnnotations;
using SqlSugar;

namespace Admin.Framework.Core.Domain.Core
{
    /// <summary>
    /// 主键必须是自增列
    /// </summary>
    public abstract class BaseEntity
    {
        [Display(Name = "自增主键")]
        [Required(ErrorMessage = "{0} 必填项")]
        [StringLength(50, ErrorMessage = "{0}stringmax{1}")]
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, IsNullable = false, ColumnDescription = "自增主键")]
        public virtual int Id { get; set; }

        [Display(Name = "创建时间")]
        [Required(ErrorMessage = "{0} 必填项")]
        [SugarColumn(IsNullable = false, Length = 7, ColumnDataType = "datetime2", ColumnDescription = "创建时间")]
        public virtual DateTime? CreateTime { get; set; }

        [Display(Name = "创建者")]
        [Required(ErrorMessage = "{0} 必填项")]
        [StringLength(50, ErrorMessage = "{0}stringmax{1}")]
        [SugarColumn(IsNullable = false, Length = 50, ColumnDataType = "nvarchar", ColumnDescription = "创建者")]
        public virtual string CreateBy { get; set; }

        [Display(Name = "修改时间")]
        [SugarColumn(IsNullable = false, Length = 7, ColumnDataType = "datetime2", ColumnDescription = "修改时间")]
        public virtual DateTime? UpdateTime { get; set; }

        [Display(Name = "修改者")]
        [Required(ErrorMessage = "{0} 必填项")]
        [StringLength(50, ErrorMessage = "{0}stringmax{1}")]
        [SugarColumn(IsNullable = false, Length = 50, ColumnDataType = "nvarchar", ColumnDescription = "修改者")]
        public virtual string UpdateBy { get; set; }

        [Display(Name = "删除时间")]
        [SugarColumn(IsNullable = false, Length = 7, ColumnDataType = "datetime2", ColumnDescription = "删除时间")]
        public virtual DateTime? DeleteTime { get; set; }

        [Display(Name = "删除者")]
        [Required(ErrorMessage = "{0} 必填项")]
        [StringLength(50, ErrorMessage = "{0}stringmax{1}")]
        [SugarColumn(IsNullable = false, Length = 50, ColumnDataType = "nvarchar", ColumnDescription = "删除者")]
        public virtual string DeleteBy { get; set; }

        [Display(Name = "启用标记")]
        [Required(ErrorMessage = "{0} 必填项")]
        [SugarColumn(IsNullable = false, ColumnDataType = "bit", ColumnDescription = "启用标记")]
        public virtual bool EnabledMark { get; set; }

        [Display(Name = "删除标记")]
        [Required(ErrorMessage = "{0} 必填项")]
        [SugarColumn(IsNullable = false, ColumnDataType = "bit", ColumnDescription = "删除标记")]
        public virtual bool DeleteMark { get; set; }

        [Display(Name = "备注")]
        [Required(ErrorMessage = "{0} 必填项")]
        [SugarColumn(IsNullable = false, ColumnDataType = "nvarchar(max)", ColumnDescription = "备注")]
        public virtual string Remark { get; set; }
    }
}